from tortoise.queryset import QuerySet

from base.base_filters import BaseFilter


class GalleryFilter(BaseFilter):

    @staticmethod
    def filter_title(query: QuerySet, value: str):
        return query.filter(title__contains=value)

    @staticmethod
    def filter_content(query: QuerySet, value: str):
        return query.filter(content__contains=value)

    @staticmethod
    def filter_category(query: QuerySet, value: str):
        return query.filter(category_id=value)


class GalleryCategoryFilter(BaseFilter):

    @staticmethod
    def filter_name(query: QuerySet, value: str):
        return query.filter(name__contains=value)
